/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.cezary.butler.walili.server.db.tasks;

import pl.cezary.butler.walili.common.Task;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Przemysław Bałdyga
 */

public class DoesTaskExistsTask extends FetchingTask<Boolean>{
    
    String POLOZENIE;
    String CEL;
    boolean isTask;
    private static final Logger log = Logger.getLogger("ZadanieIsTask"); 
    
    public DoesTaskExistsTask(Task z) {
        POLOZENIE=z.getPolozenie();
        CEL=z.getCel();
    }
   
    
    @Override
    public void executeInternal() {
        
        /*String st=null;
            if(POLOZENIE==null)
                st = " SELECT * FROM ((zad_polozenie NATURAL  JOIN zadania_id ) JOIN zad_reszta) WHERE cel like '" + CEL + "'";
             else 
                st = "SELECT * FROM ((zad_polozenie NATURAL  JOIN zadania_id )JOIN zad_reszta) WHERE polozenie like '"+POLOZENIE+"' AND cel like '"+ CEL + "'";
            Statement que = null;
            Connection c=getDS().getConnection();
            que = c.createStatement();
            ResultSet res=que.executeQuery(st);            
            isTask = res.next();
            que.close();*/
        
    }

    @Override
    protected Boolean $getResultsNonLocking() {
        return isTask;
    }
    

}
